// typedefs.h


typedef struct
{
    unsigned int  uiLen;                         //!< Length of valid bytes in data inclusive stx/etx
    unsigned char data[ C_MAX_CMD_LEN * 2 + 2];  //!< double the command plus stx/etx
} T_STXETX_PACKET;

/*! \brief command structure
*/
typedef struct
{
    unsigned char ucLen;
    unsigned char data[C_MAX_CMD_LEN];
} T_CMD;

typedef struct
{
    unsigned char ucState;
    unsigned char rxNewFrameRecv;
    unsigned int rxCRCError;
    T_STXETX_PACKET rxBuffer;
    unsigned char rxIndex;
    T_CMD rxCmd;
    T_STXETX_PACKET txBuffer;
    unsigned char txSendState;
    unsigned char txIndex;
    unsigned char ucSending;
} t_rfm12;

typedef struct s_tempSens
{
    unsigned char ucID[8];
    unsigned int uiMeasVal;
    unsigned char ucLogID; // Logical ID
    signed int siTemp;
} t_tempSens;

typedef struct s_tempSensors
{
    unsigned char ucNumSensors;
    t_tempSens sSensor[C_MAX_NUMBER_OF_SENSORS];
} t_tempSensors;


typedef struct s_time
{
    unsigned int uiTick;
    unsigned long ulSeconds;
    unsigned char second;
    unsigned char minute;
    unsigned long hour;
} t_time;

typedef struct s_date
{
    unsigned char ucDay;
    unsigned char ucWeekDay;
    unsigned char ucMonth;
    unsigned char ucYear;
} t_date;

typedef struct s_buttons
{
    unsigned char btn[4];
} t_buttons;

typedef struct s_appSettings
{
    signed int siCtrlTargetTemp;
    unsigned char ucEnTempControl;
    unsigned int uiBgLightTimeout;
	unsigned int uiLogInterval;
} t_appSettings;

typedef struct s_uartFifo
{
    unsigned char data[C_SIZE_UART_BUFFER];
    unsigned int uiInPos;
    volatile unsigned int uiOutPos;
} t_uartFifo;

typedef struct s_menuPage
{
	unsigned char pageID;
	unsigned char nextPage;
	unsigned char prevPage;
	unsigned char fClearScreen;
}t_menuPage;

typedef struct s_tempLog
{
	unsigned long ulLastRecValue;
	unsigned char fUpdateGraph;
	unsigned char logValues[64];
}t_tempLog;